﻿function CarregarCampos(pTr)
{
    document.getElementById("ctl00_ContentPlaceHolder1_txtNomeTermo").value = pTr.childNodes[0].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_txtModulo").value = pTr.childNodes[1].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_txtModuloPai").value = pTr.childNodes[2].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_txtFiltro").value = pTr.childNodes[3].innerText;        
    document.getElementById("ctl00_ContentPlaceHolder1_txtFonteTipo").value = pTr.childNodes[4].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_txtFonte").value = pTr.childNodes[5].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_txtSugestaoData").value = pTr.childNodes[6].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_txtTextoAjuda").value = pTr.childNodes[7].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_DrpResponsavel").value = pTr.childNodes[8].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_ChkTermoAvaliado").checked = (pTr.childNodes[9].innerText == "True");
    document.getElementById("ctl00_ContentPlaceHolder1_ChkTermoDesprezado").checked = (pTr.childNodes[10].innerText == "True");
    document.getElementById("ctl00_ContentPlaceHolder1_txtTermoSugerido").value = pTr.childNodes[11].innerText;
}

function CarregarCamposPesquisaGlossario(pTr)
{
    document.getElementById("ctl00_ContentPlaceHolder1_txtNomeTermo").value = pTr.childNodes[0].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtNomePreterido1").value = pTr.childNodes[4].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtNomePreterido2").value = pTr.childNodes[5].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtNomePreterido3").value = pTr.childNodes[6].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtNomePreterido4").value = pTr.childNodes[7].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtNomePreterido5").value = pTr.childNodes[8].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtNomePreterido6").value = pTr.childNodes[9].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtDescricao").value = pTr.childNodes[10].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtAbreviaturas1").value = pTr.childNodes[1].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtAbreviaturas2").value = pTr.childNodes[2].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtNomeFisico").value = pTr.childNodes[11].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtTermoRecomendado").value = pTr.childNodes[13].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtDataDocumentacao").value = pTr.childNodes[14].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtDataValidacao").value = pTr.childNodes[16].innerText;
    document.getElementById("ctl00_ContentPlaceHolder1_TxtComentario").value = pTr.childNodes[18].innerText;
    
    if (pTr.childNodes[12].innerText == "True")
    {
        document.getElementById("ctl00$ContentPlaceHolder1$ChkSinonimo").checked = "checked";
    }
    else
    {
        document.getElementById("ctl00$ContentPlaceHolder1$ChkSinonimo").checked = "";
    }
    
    if (pTr.childNodes[15].innerText != " ")
    {
        document.getElementById("ctl00_ContentPlaceHolder1_DrpResponsavelDocumentacao").value = pTr.childNodes[15].innerText;
    }
    else
    {
        document.getElementById("ctl00_ContentPlaceHolder1_DrpResponsavelDocumentacao").SelectedIndex = 0;
    }
    
    if (pTr.childNodes[17].innerText != " ")
    {
        document.getElementById("ctl00_ContentPlaceHolder1_DrpResponsavelValidacao").value = pTr.childNodes[17].innerText;
    }
    else
    {
        document.getElementById("ctl00_ContentPlaceHolder1_DrpResponsavelValidacao").SelectedIndex = 0;
    }
}


function setUrl(url)
{
    debugger;
    document.getElementById('paginas').src = url;  
}


function CarregarCampoFonteChave(pTr)
{
    document.getElementById("ctl00_ContentPlaceHolder1_txtNomeTermo").value = pTr.childNodes[0].innerText;    
}


function apresentaDetalhes(pId)
{
    var iframe = document.getElementById('iframeDetalhes');
    iframe.src = 'FontesDetalhe.aspx?id=' + pId;
    iframe.style.display = 'block';
}

